package com.woniuxy.controller;


import com.woniuxy.mapper.PaymentMapper;
import com.woniuxy.model.entity.Payment;
import com.woniuxy.service.PaymentService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api(tags = "支付方式管理")
@Slf4j
@RestController
@RequestMapping("/payment")
public class PaymentController {


    @Autowired
    private PaymentMapper paymentMapper;

    @GetMapping("/methods")
    public ResponseEntity<?> getPaymentMethods() {
        try {
            List<Payment> methods = paymentMapper.selectList(null);
            return ResponseEntity.ok(methods);
        } catch (Exception e) {
            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("获取支付方式失败：" + e.getMessage());
        }
    }

}
